<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<meta charset="utf-8" />
<title>仪表盘 - FinalCMS Admin</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0" />

<link rel="stylesheet" href="${ctx}/css/bootstrap.min.css" />
<link rel="stylesheet" href="${ctx}/css/font-awesome.min.css" />
<link rel="stylesheet" href="${ctx}/css/jquery-ui.custom.min.css" />
<link rel="stylesheet" href="${ctx}/css/jquery.gritter.css" />
<!--[if lte IE 9]>
<link rel="stylesheet" href="${ctx}/css/fc-part2.min.css" />
<![endif]-->
<link rel="stylesheet" href="${ctx}/css/fc-skins.min.css" />
<link rel="stylesheet" href="${ctx}/css/fc-rtl.min.css" />
<link rel="stylesheet" href="${ctx}/css/fc-fonts.css" />
<link rel="stylesheet" href="${ctx}/css/fc.min.css" />
<link rel="stylesheet" href="${ctx}/css/fc-custom.css" />

<!--[if lte IE 9]>
 <link rel="stylesheet" href="${ctx}/css/fc-ie.min.css" />
<![endif]-->

<!--[if lte IE 8]>
<script type="text/javascript" src="${ctx}/js/html5shiv.js"></script>
<script type="text/javascript" src="${ctx}/js/respond.min.js"></script>
<![endif]-->
</head>

<body class="no-skin">
<?include("../../inc/menu.html",{current:"friendlink_add"}){}?>
<div class="main-content">
<div class="breadcrumbs" id="breadcrumbs">
	<ul class="breadcrumb">
		<li><i class="ace-icon fa fa-home home-icon"></i> <a href="${ctx}/admin/account/dashboard">首页</a>
		</li>
		<li class="active">友情链接</li>
	</ul>
</div>

<div class="page-content">
	<div class="page-header">
		<h1>友情链接
		<small><i class="ace-icon fa fa-angle-double-right"></i> <?if(isEmpty(f)) {?>添加<?}else{?>编辑<?}?></small>
		</h1>
	</div>
	<div class="row">
		<div class="col-xs-12">
		<?if(!isEmpty(error)) {?>${error}<?}?>
		<form id="frm" class="form-horizontal" role="form" method="post">
			<input type="hidden" name="friendLinkEntity.state" id="state" />
			<?if(!isEmpty(f)) {?>
			<input type="hidden" name="friendLinkEntity.id" id="id" value="${f.id}"/>
			<?}?>
			<div class="form-group">
				<label class="col-sm-3 control-label" for="form-field-1">关键词</label>
				<div class="col-sm-9">
					<input type="text" id="keyword" name="friendLinkEntity.keyword" value="${f.keyword!}" placeholder="关键词" class="col-xs-10 col-sm-5" />
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-3 control-label" for="form-field-1">链接地址</label>
				<div class="col-sm-9">
					<input type="text" id="url" name="friendLinkEntity.url" value="${f.url!}" placeholder="链接地址" class="col-xs-10 col-sm-5" />
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-3 control-label" for="form-field-1">logo地址</label>
				<div class="col-sm-9">
					<input type="text" id="logo" name="friendLinkEntity.logo" value="${f.logo!}" placeholder="logo地址" class="col-xs-10 col-sm-5" />
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-3 control-label" for="form-field-1"></label>
				<span class="help-inline col-xs-1 col-sm-1">
					<label class="middle">
						<?if(isEmpty(f) || f.state==1 ){?>
						<input class="ace" type="checkbox" id="_state" checked="checked" />
						<span class="lbl"> 启用</span>
						<?} else {?>
						<input class="ace" type="checkbox" id="_state"/>
						<span class="lbl"> 禁用</span>
						<?}?>
					</label>
				</span>
			</div>
			<div class="clearfix form-actions">
				<div class="col-md-offset-2 col-md-5">
					<?if(!isEmpty(f)){?>
					<a class="btn btn-sm pull-left" href="${ctx}/admin/friendlink">
						<i class="ace-icon fa fa-arrow-left"></i> 返回
					</a>
					<?}?>
					<button class="btn btn-info pull-right" type="button" id="submitBtn">
						<i class="ace-icon fa fa-check bigger-110"></i> 提交
					</button>
				</div>
			</div>
		</form>
		</div>
	</div>
</div>
</div>
</div>
<?include("../../inc/footer.html"){}?>

<script type="text/javascript" src='${ctx}/js/jquery1.11.0.min.js'></script>
<script type="text/javascript" src="${ctx}/js/bootstrap.min.js"></script>
<script type="text/javascript" src="${ctx}/js/fc.min.js"></script>
<script type="text/javascript">
jQuery(function($) {
	$("#submitBtn").click(function(){
		if($.trim($("#keyword").val()).length == 0) {
			alert("关键词不能为空");
			return false;
		}
		if($.trim($("#url").val()).length == 0) {
			alert("链接地址不能为空");
			return false;
		}
		if($("#_state").is(":checked")) {
			$("#state").val(1);
		} else {
			$("#state").val(0);
		}
		
		<?if(isEmpty(f)) {?>
		$("#frm").attr("action", "${ctx}/admin/friendlink/save");
		<?}else{?>
		$("#frm").attr("action", "${ctx}/admin/friendlink/doEdit");
		<?}?>
		$("#frm").submit();
	});
});
</script>
</body>
</html>
